const { SitemapStream, streamToPromise } = require('sitemap')
const fs = require('fs')
const smStream = new SitemapStream({ hostname: 'https://bittopup.com/' })

str.split(/\n/).forEach((uri) => {
  console.log(uri)
  try {
    smStream.write({ url: uri.trim(), changefreq: 'weekly' })
  } catch (e) {}
})
// make sure to attach a write stream such as streamToPromise before ending
smStream.pipe(fs.createWriteStream('./public/sitemap.xml'))
smStream.end()
console.log('ok')
